package com.yanmaohu.yulia.bean;

/**
 * @author Bright Lee
 */
public final class ConditionAction {

    private int beginIndex;
    private int endIndex;
    private GotoTarget gotoTarget;

    public ConditionAction(int beginIndex, int endIndex) {
        this.beginIndex = beginIndex;
        this.endIndex = endIndex;
    }

    public ConditionAction(int beginIndex, GotoTarget gotoTarget) {
        this.beginIndex = beginIndex;
        this.endIndex = gotoTarget.getEndIndex();
        this.gotoTarget = gotoTarget;
    }

    public int getBeginIndex() {
        return beginIndex;
    }

    public int getEndIndex() {
        return endIndex;
    }

    public GotoTarget getGotoTarget() {
        return gotoTarget;
    }

    public boolean isContinue() {
        return gotoTarget == null;
    }

    public boolean isGoto() {
        return gotoTarget != null;
    }

}
